﻿using BBCore.Core.Models.OracleEntity.BOM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BBCore.Application.OracleApplication.BOM.Interface;

namespace BBCore.Application.OracleApplication.BOM.Service
{
    public class MsiService: IMsiService
    {
        private readonly IFreeSql FreeSql;
        public MsiService(IFreeSql freeSql) => FreeSql = freeSql;
        public MSI? GetMsi(int orgid, string item_code)
        {
            //new MSI 强制指定类型
            var lit = FreeSql.Select<MSI>()
                .Where(x => x.SEGMENT1 == item_code && x.ORGANIZATION_ID == orgid)
                //.ToList(x => new MSI { DESCRIPTION = x.DESCRIPTION, ITEM_TYPE = x.ITEM_TYPE })
                .ToList()
                .FirstOrDefault();
            return lit;
        }
    }
}
